package xx.services.entity.rest;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Context;

import xx.entity.bas.MoodLink;
import xx.services.Passport;
import xx.services.entity.inter.IMoodInterface;
import xx.services.util.Constants;

/**
 * 心情描述服务接口
 * 
 * @Path (Constants.RESTFUL_ROOT_PATH + "/mood")
 * @author Administrator
 * 
 */
@Path(Constants.RESTFUL_ROOT_PATH + "/mood")
public class MoodRest extends Passport implements IMoodInterface
{

    public MoodRest(@Context
    HttpServletRequest request)
    {
        super(request);
        // TODO Auto-generated constructor stub
    }

    /**
     * 为心情{mood_id}的值加1。
     * 
     * @PUT
     * @Path ("/{mood_id}/entity/{entity_id}")
     * @param moodId-@PathParam("mood_id")
     *            心情ID
     * @param entityId-@PathParam("entity_id")
     *            实体ID
     * @return 最新的心情值
     * @author dengjinye,2010-10-29
     */
    @PUT
    @Path("/{mood_id}/entity/{entity_id}")
    public String updateMood(@PathParam("mood_id")
    long moodId, @PathParam("entity_id")
    long entityId)
    {
        try
        {
            MoodLink ml = new MoodLink(qr, owner);
            ml.setMoodId(moodId).setEntityId(entityId);
            ml.total(MoodLink.TOTAL, 1);
            return ok(true);
        }
        catch (Exception e)
        {
            return error(e);
        }
    }
}
